package com.fancy.learncenter.activity;

import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import com.fancy.learncenter.activity.base.BaseActivity;
import com.fancy.learncenter.bean.BaseDataBean;
import com.fancy.learncenter.bean.UserAccountDataBean;
import com.fancy.learncenter.net.HttpMehtod;
import com.fancy.learncenter.net.IdeaObserver;
import com.fancy.learncenter.utils.ToastUtil;
import com.superservice.lya.R;

import java.util.HashMap;
import java.util.Map;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ReflectMoneyActivity extends BaseActivity {


    @Bind(R.id.money_tv)
    EditText moneyTv;
    @Bind(R.id.total_money)
    TextView totalMoney;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reflect_money, getResources().getColor(R.color.toolbar_color));
        ButterKnife.bind(this);
        initToolbar("提现");

        String money = getIntent().getStringExtra("totalMoney");
        totalMoney.setText(money);
    }


    @OnClick(R.id.submit)
    public void onViewClicked() {
        getAccount();
    }


    private void getAccount() {
        Map maps = new HashMap();
        maps.put("money", moneyTv.getText().toString());
        HttpMehtod.getInstance().userReflect(maps, new IdeaObserver<BaseDataBean<UserAccountDataBean>>(this, true) {

            @Override
            public void onSuccess(BaseDataBean<UserAccountDataBean> stringBaseDataBean) {

                finish();
                ToastUtil.show("提现成功");
            }

            @Override
            public void onFail(int errorCode) {

            }

        });
    }
}
